package com.qing.microservices.kafkaproducer;

import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;

/**
 * @author guoqf
 */
@Component
public class KafkaSender {

    private final KafkaTemplate<String, String> stringKafkaTemplate;

    public KafkaSender(KafkaTemplate<String, String> stringKafkaTemplate) {
        this.stringKafkaTemplate = stringKafkaTemplate;
    }

    public void send(String topic, String message) {
        stringKafkaTemplate.send(topic, message);
    }
}
